package com.fyl.utils;

import com.baomidou.mybatisplus.core.metadata.IPage;

import java.util.List;

public class PageResp<T> {

    private Long current;

    private Long size;

    private Long pages;

    private Long total;

    private List<T> list;

    public static <T> PageResp<T> build(IPage<T> page) {
        PageResp<T> resp = new PageResp<>();
        resp.setCurrent(page.getCurrent());
        resp.setSize(page.getSize());
        resp.setPages(page.getPages());
        resp.setTotal(page.getTotal());
        resp.setList(page.getRecords());
        return resp;
    }

    public Long getCurrent() {
        return current;
    }

    public void setCurrent(Long current) {
        this.current = current;
    }

    public Long getSize() {
        return size;
    }

    public void setSize(Long size) {
        this.size = size;
    }

    public Long getPages() {
        return pages;
    }

    public void setPages(Long pages) {
        this.pages = pages;
    }

    public Long getTotal() {
        return total;
    }

    public void setTotal(Long total) {
        this.total = total;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }
}
